package com.shanyu.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.github.pagehelper.PageInfo;
import com.shanyu.dto.ArticleDto;
import com.shanyu.service.IArticleService;

@RestController
@RequestMapping(value = "/article")
public class ArticleController {

	@Autowired
	private IArticleService articleService;
	
	@RequestMapping(value = "/detail/get",method = RequestMethod.GET)
	public ArticleDto getArticleDetail(String articleId) throws Exception{
		return articleService.getArticleDetail(articleId);
	}
	
	@RequestMapping(value = "/list",method = RequestMethod.GET)
	public PageInfo getArticleByPage(String classificaId,
			@RequestParam(defaultValue = "1") int pageNum, 
			@RequestParam(defaultValue = "10") int pageSize){
		return articleService.getArticleByPage(classificaId, pageNum, pageSize);
	}
	
}
